/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package co.edu.sd.jxta.service;

/**
 *
 * @author SD
 */
public enum ServiceType {

    GENERAL_MESSAGE("GENERAL_MESSAGE_SERVICE", "Used for receiving messages and notifications"),
    UTC_TIME("UTC_TIME_SERVICE", "The time in UTC"),
    FILE_UPLOAD("FILE_UPLOAD_SERVICE", "Upload a file into a peer"),
    FILE_DOWNLOAD("FILE_DOWNLOAD_SERVICE", "Download a file from a peer"),
    FILE_SEARCH("FILE_SEARCH_SERVICE", "Search a file"),
    APP_EXEC("APP_EXEC_SERVICE", "Execute an application in a peer"),
    RECOVER_FILE_UPLOAD("RECOVER_FILE_UPLOAD_SERVICE", "Recover from a upload process"),
    RECOVER_FILE_DOWNLOAD("RECOVER_FILE_DOWNLOAD_SERVICE", "Recover from a download process"),
    STATE_FILE_UPLOAD_RECOVERY("STATE_FILE_UPLOAD_RECOVERY_SERVICE", "Recover from a upload process"),
    SAVE_STATE("GLOBAL_STATE_SERVICE",""),
    DH_AGGREEMENT("DH_AGGREEMENT_SERVICE",""),
    STATE_FILE_DOWNLOAD_RECOVERY("STATE_FILE_DOWNLOAD_RECOVERY_SERVICE","Recover from a download process");

    private String name;
    private String desc;
    /**
     *
     * @param name
     * @param desc
     */
    ServiceType(String name, String desc) {
        this.name = name;
        this.desc = desc;
    }
    /**
     *
     * @return
     */
    public String getDesc() {
        return desc;
    }
    /**
     *
     * @return
     */
    public String getName() {
        return name;
    }

    /**
     *
     * @param sType
     * @return
     */
    public static ServiceType getTypeByID(String sType) {
        ServiceType en[] = ServiceType.values();

        for (ServiceType serviceType : en) {
            if (serviceType.getName().equals(sType)) {
                return serviceType;
            }
        }
        return null;
    }
}
